package basic.sort;

import java.util.Arrays;

/**
 * @创建人 MBY381
 * @创建时间 2022/3/28 15:13
 * @描述 暂无
 */
public class B_BubbleSort {
    public static int[] sort(int[] nums) {
        for (int i = 0; i < nums.length - 2; i++) {
            for (int j = 0; j < nums.length - 1; j++) {
                if (nums[j] > nums[j + 1]) {
                    int temp = nums[j];
                    nums[j] = nums[j + 1];
                    nums[j + 1] = temp;
                }

            }
        }
        return nums;
    }

    public static void main(String[] args) {
        System.out.println("正确答案：    [1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 227, 259, 381, 696, 782]");
        int[] nums = new int[]{0xE3, 381, 8, 6, 4, 7, 9, 3, 5, 2, 1, 782, 696, 259, 0x15};
        System.out.println(Arrays.toString(sort(nums)));
    }
}
